<?php
/**
 * 
 * @author truonghm
 * @version $1.0
 * @date 06/04/2011
 *
 */

class Models_Grid extends Zend_Db_Table_Abstract {
	protected $_name = 'grid';
	protected $_primary = 'id';
	
	/**
	 * @author truonghm
	 * @date 06/04/2011
	 * @desc get thong tin cau hinh grid trong database	 
	 */
	public function getGridConfig($p_gridKey){
		
		$lbl_grid = new Models_Grid();		
		$lbl_gridConfig = new Models_GridConfig();
		
		$vc_select = $lbl_grid->select()
							  ->setIntegrityCheck(false)
							  ->from(array("g"=>$lbl_grid->info("name")) ,array("g.table_name"))
							  ->joinLeft(array("gc"=>$lbl_gridConfig->info("name")),"g.id = gc.grid_id",array("gc.*"))
							  ->where("g.code=?",$p_gridKey);
							  
		$arr_data = $lbl_grid->fetchAll($vc_select);
		
		//khong co du lieu cau hinh reader va column
		if(!$arr_data) return;	
			
		$arr_field=$arr_data->toArray();		
		return $arr_field;			
	}
}


?>